package com.wo56.pushmsgcenter.common.exe;

import java.util.Iterator;

import com.framework.components.redis.RedisHelper;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.ShardedJedis;

public class TestRedisServer {

	public static void main(String[] args) throws Exception {
		Jedis jedis = null;
		if(RedisHelper.getInstance().isShared()){
			ShardedJedis shardedJedis = (ShardedJedis) RedisHelper.getInstance().getJedis();
			Iterator it = shardedJedis.getAllShards().iterator();
			//分片的话拿第1台做消息服务器
			jedis = (Jedis) it.next();
		}else{
			jedis = (Jedis) RedisHelper.getInstance().getJedis();
		}
		for(int i=1;i<=100;i++){
			jedis.publish("test", "Redis is a great caching technique"+i);  
	        jedis.publish("test", "build your dream"+i);  
	        jedis.publish("test", "over"+i);  
		}

	}

}
